import { Link, useNavigate } from "react-router-dom";

function Login() {
    const navigate = useNavigate();
    return (
        <div>
            我是Login页面
            {/* 声明式跳转 */}
            <Link to="/home">跳转到Home</Link>
            {/* 命令式跳转 */}
            <button onClick={() => navigate("/home")}>跳转到Home</button>
            <button onClick={() => navigate("/home?id=1001&name=cyx")}>searchParams传参</button>
            <button onClick={() => navigate("/home/1001")}>params传参</button>
            <button onClick={() => navigate("/home", { state: { id: 1001, name: "cyx" } })}>state传参</button>
        </div>
    );
}
export default Login